<?php

/**
 * Plan form base class.
 *
 * @method Plan getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePlanForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plan_id'               => new sfWidgetFormInputHidden(),
      'name'                  => new sfWidgetFormInputText(),
      'period'                => new sfWidgetFormChoice(array('choices' => array('month' => 'month', 'year' => 'year'))),
      'label'                 => new sfWidgetFormInputText(),
      'display_order'         => new sfWidgetFormInputText(),
      'upgrade_order'         => new sfWidgetFormInputText(),
      'subscription_offer_id' => new sfWidgetFormInputText(),
      'salesforce_id'         => new sfWidgetFormInputText(),
      'cost'                  => new sfWidgetFormInputText(),
      'extra_credit'          => new sfWidgetFormInputText(),
      'job_slots'             => new sfWidgetFormInputText(),
      'is_active'             => new sfWidgetFormInputCheckbox(),
      'is_customizable'       => new sfWidgetFormInputCheckbox(),
      'is_import_auto'        => new sfWidgetFormInputCheckbox(),
      'is_api_enabled'        => new sfWidgetFormInputCheckbox(),
      'is_engines_enabled'    => new sfWidgetFormInputCheckbox(),
      'is_cost_public'        => new sfWidgetFormInputCheckbox(),
      'features'              => new sfWidgetFormInputText(),
      'created_at'            => new sfWidgetFormDateTime(),
      'updated_at'            => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'plan_id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('plan_id')), 'empty_value' => $this->getObject()->get('plan_id'), 'required' => false)),
      'name'                  => new sfValidatorString(array('max_length' => 255)),
      'period'                => new sfValidatorChoice(array('choices' => array(0 => 'month', 1 => 'year'), 'required' => false)),
      'label'                 => new sfValidatorString(array('max_length' => 255)),
      'display_order'         => new sfValidatorInteger(),
      'upgrade_order'         => new sfValidatorInteger(),
      'subscription_offer_id' => new sfValidatorString(array('max_length' => 255)),
      'salesforce_id'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'cost'                  => new sfValidatorInteger(),
      'extra_credit'          => new sfValidatorInteger(),
      'job_slots'             => new sfValidatorInteger(),
      'is_active'             => new sfValidatorBoolean(array('required' => false)),
      'is_customizable'       => new sfValidatorBoolean(array('required' => false)),
      'is_import_auto'        => new sfValidatorBoolean(array('required' => false)),
      'is_api_enabled'        => new sfValidatorBoolean(array('required' => false)),
      'is_engines_enabled'    => new sfValidatorBoolean(array('required' => false)),
      'is_cost_public'        => new sfValidatorBoolean(array('required' => false)),
      'features'              => new sfValidatorPass(array('required' => false)),
      'created_at'            => new sfValidatorDateTime(),
      'updated_at'            => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('plan[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Plan';
  }

}
